<template>
  <div>
    <a-menu theme="dark" mode="inline" :open-keys="openKeys" style="width: 256px" @openChange="onOpenChange">
      <!-- <a-sub-menu key="sub1">
        <span slot="title"><a-icon type="check" /><span>班级内容管理</span></span>
        <a-menu-item key="1">
          Option 1
        </a-menu-item>
        <a-menu-item key="2">
          Option 2
        </a-menu-item>
        <a-menu-item key="3">
          Option 3
        </a-menu-item>
      </a-sub-menu> -->
      <a-sub-menu key="sub2">
        <span slot="title"><a-icon type="check" /><span>用户管理</span></span>
        <a-menu-item key="4" @click="guanliyuan">
          管理员管理
        </a-menu-item>
        <a-menu-item key="5" @click="xuesheng">
          学生管理
        </a-menu-item>
      </a-sub-menu>
      <a-sub-menu key="sub3">
        <span slot="title"><a-icon type="check" /><span>课堂内容管理</span></span>
        <a-menu-item key="9" @click="ketangneirong">
          课堂内容管理
        </a-menu-item>
        <!-- <a-menu-item key="10">
          Option 10
        </a-menu-item> -->
      </a-sub-menu>
      <!-- <a-sub-menu key="sub4">
        <span slot="title"><a-icon type="check" /><span>算法练习</span></span>
        <a-menu-item key="11">
          Option 9
        </a-menu-item>
        <a-menu-item key="12">
          Option 10
        </a-menu-item>
      </a-sub-menu> -->
      <a-sub-menu key="sub5">
        <span slot="title"><a-icon type="check" /><span>作业管理及考评</span></span>
        <a-menu-item key="13" @click="publishHomework">
          发布作业
        </a-menu-item>
        <!-- <a-menu-item key="14">
          评判作业
        </a-menu-item>
        <a-menu-item key="15">
          成绩管理
        </a-menu-item> -->
      </a-sub-menu>
    </a-menu>
  </div>
</template>
<script>
export default {
  data() {
    return {
      rootSubmenuKeys: ['sub1', 'sub2', 'sub4'],
      openKeys: ['sub2'],
    };
  },
  methods: {
    onOpenChange(openKeys) {
      const latestOpenKey = openKeys.find((key) => this.openKeys.indexOf(key) === -1);
      if (this.rootSubmenuKeys.indexOf(latestOpenKey) === -1) {
        this.openKeys = openKeys;
      } else {
        this.openKeys = latestOpenKey ? [latestOpenKey] : [];
      }
    },
    guanliyuan() {
      this.$router.push('/manage/guanliyuanguanli');
    },
    xuesheng() {
      this.$router.push('/manage/xueshengguanli');
    },
    ketangneirong() {
      this.$router.push('/manage/ketangneirongguanli');
    },
    publishHomework() {
      this.$router.push('/manage/publishHomework');
    },
  },
};
</script>
